package com.sleep.psy.external_server.business.main.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sleep.psy.external_server.business.main.entity.MainDistributer;
import com.sleep.psy.external_server.business.main.mapper.MainDistributerMapper;
import com.sleep.psy.external_server.business.main.service.MainDistributerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 分销关系表 服务实现类
 * </p>
 *
 * @author wenliguo
 * @since 2025-08-12
 */
@Service
public class MainDistributerServiceImpl extends ServiceImpl<MainDistributerMapper, MainDistributer> implements MainDistributerService {

    @Autowired
    private MainDistributerMapper mainDistributerMapper;

    /**
     * 通过用户id查询绑定的医生
     * @author wenliguo
     * @date 2025/8/12 11:51
     * @param userId 用户id
     * @return com.sleep.psy.external_server.main.entity.MainDistributer
     */
    @Override
    public MainDistributer selectByUserId(Long userId) {
        QueryWrapper<MainDistributer> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id", userId);
        return mainDistributerMapper.selectOne(wrapper);
    }
}
